package com.cherrish.demo;

/**
 * @author cherrish
 * @time 2019-01-22 16:09
 * @name SunTest
 * @desc:
 */
public class SunTest {
    public static void main(String[] args) {
        int[] arr = {2,1,4,4,7,8,8,3,11,99,100,10,33,22,44,66,55,77,88};
        sort(arr, arr.length);
        for(int i = 0; i < arr.length; i++){
            System.out.println(arr[i]);
        }
    }
    static private void sort(int[] arr, int len){
        for(int i = 0; i < len; i++){
            for(int j = 0; j < len - i - 1; j++){
                if(arr[j] > arr[j + 1]){
                    swap(arr, j, j + 1);
                }
            }
        }
    }
    static private void swap(int[] arr, int x, int y){
        int temp = arr[x];
        arr[x] = arr[y];
        arr[y] = temp;
    }
}
